package flc.ast.fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.blankj.utilcode.util.FragmentUtils;

import java.util.ArrayList;
import java.util.List;

import flc.ast.R;
import flc.ast.databinding.FragmentHomeBinding;
import stark.common.basic.base.BaseNoModelFragment;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link HomeFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class HomeFragment extends BaseNoModelFragment<FragmentHomeBinding> {

    public static List<Fragment> mFragmentList;
    private ModeFragment modeFragment;
    private FishFragment fishFragment;

    @Override
    protected int onCreate() {
        return R.layout.fragment_home;
    }

    @Override
    protected void initView() {
        mFragmentList = new ArrayList<>();
        modeFragment = new ModeFragment();
        mFragmentList.add(modeFragment);
        fishFragment = new FishFragment();
        mFragmentList.add(fishFragment);
        FragmentUtils.add(getChildFragmentManager(), mFragmentList, R.id.fl_container, 0);
    }

    @Override
    protected void initData() {

    }

    @Override
    public void onHiddenChanged(boolean hidden) {
        super.onHiddenChanged(hidden);
        fishFragment.onHiddenChanged(hidden);
    }

    public static void onClickMode(int position) {
        FishFragment.type = position;
        FragmentUtils.showHide(1, mFragmentList);
    }

}